package com.cebbank.yyi.springbootapp.jingtang.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum DocUserQueryInfoEnum {

    NOTICE(InnerDocUserQueryInfoEnum.VIEW_PERMISSIONS, "NOTICE", "通知"),
    DOC_DOWNLOAD(InnerDocUserQueryInfoEnum.DOWNLOAD_PERMISSIONS, "DOC_DOWNLOAD", "下载");

    private final InnerDocUserQueryInfoEnum oldId;

    private final String name;

    private final String displayName;

    public static DocUserQueryInfoEnum getByOldId(InnerDocUserQueryInfoEnum oldId) throws Exception {
        if (oldId == null) {
            System.out.print("DocUserQueryInfoEnum：老系统ID为空");
            return null;
        }
        for (DocUserQueryInfoEnum type : DocUserQueryInfoEnum.values()) {
            if (oldId.equals(type.getOldId())) {
                return type;
            }
        }
        throw new Exception("DocUserQueryInfoEnum：老系统ID映射失败，当前OLD_ID为：" + oldId);
    }

    @Getter
    @RequiredArgsConstructor
    public enum InnerDocUserQueryInfoEnum {

        VIEW_PERMISSIONS,
        DOWNLOAD_PERMISSIONS;
    }
}
